package com.controller;

import com.model.User;
import com.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user/rest")
public class UserRestController {
    @Autowired
    private UserService userService;

    @RequestMapping(value="/list",method = RequestMethod.POST)
    public List<User> index(){
        return userService.getUserList();
    }

    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public String addUser(@RequestParam User user){
        return "ok";
    }


}
